package com.comm.db.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class jdbctest {
	
	public static Connection conn=null;
	static String My_SQL_SID1 = "opt";//"dbtest";// Intelligence/whwj6576

	static String My_SQL_dbUser = "root";// "QX10";

	static String My_SQL_dbPassword_1_0 = "root";//"root";// "QX10" ;

	static String My_SQL_SIP = "localhost";

	static String My_SQL_port = "3306";

	static String jdbc_url = "jdbc:mysql://" + My_SQL_SIP + ":"
			+ My_SQL_port + "/" + My_SQL_SID1+"?characterEncoding=utf8";//jdbc:mysql://172.26.6.57:3306/discuz

	static String  My_SQL_DriverString = "com.mysql.JDBC.Driver";
	
	static {
		
			try {
				Class.forName(My_SQL_DriverString);
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
	
	
	public static Connection createConnection (){	
		Connection _conn;
		try {
			_conn = (Connection) DriverManager.getConnection(jdbc_url, My_SQL_SID1,
					My_SQL_dbUser);
			conn=_conn;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		
			
		
		return conn;
	}
	public static void main(String []arg){
		Connection conn=createConnection();
		System.out.println(conn);
		
	}
}
